program mynormal2
	version 9.1
	if replay() {
		if (`"`e(cmd)'"' != "mynormal2") error 301
		Replay `0'
	}
	else	Estimate `0'
end

program Estimate, eclass sortpreserve
	syntax varlist [if] [in] [,		///
		vce(passthru)			///
		CLuster(varname)		/// <- NEW
		HETero(varlist)			/// <- NEW
		Level(cilevel)			/// -Replay- options
	]

	// check syntax
	gettoken lhs rhs : varlist
	if "`cluster'" != "" {				// NEW block
		local clopt cluster(`cluster')
	}
	// mark the estimation sample
	marksample touse

	// fit the full model
	ml model d2 mynormal_d2				///
		(mu: `lhs' = `rhs')			///
		(lnsigma: `hetero')			/// <- NEW
		if `touse',				///
		`vce'					///
		`clopt'					/// <- NEW
		maximize

	ereturn local cmd mynormal2

	Replay , level(`level')
end

program Replay
	syntax [, Level(cilevel) ]
	ml display , level(`level')
end
